import { ref, reactive } from "vue";
import axios from "axios";

export default function () {
  let dogList = reactive([
    "https://images.dog.ceo/breeds/pembroke/n02113023_5848.jpg",
  ]);

  const dogApi = "https://dog.ceo/api/breed/pembroke/images/random";

  async function addDog() {
    try {
      let result = await axios.get(dogApi);
      dogList.push(result.data.message);
    } catch (error) {
      alert(error);
    }
  }

  return {
    dogList,
    addDog,
  };
}
